#pragma once
#include <math.h>
#include <sfml/Graphics/RenderWindow.hpp>
#include "Vector2.h"

/*
	Region is a Rectangle with some usefull values.
	Used for Soccer Pith itself and to define its subregions.
*/

class Region
{

public:
	Region();
	Region(float top, float left, float bottom, float right, int id = -1);
	Region(Vector2 center, float apothem, int id = -1);
	~Region(){}

	inline float Top()const{ return m_top; }
	inline float Left()const{ return m_left; }
	inline float Bottom()const{ return m_bottom; }
	inline float Right()const{ return m_right; }

	inline float Width()const{ return m_width; }
	inline float Height()const{ return m_height; }
	
	inline Vector2 Center()const{ return m_center; }

	inline int ID()const{ return m_id; }

	Region IntersectionWith(const Region& other) const;

	bool Inside(const Vector2& pos);
	Vector2 RandomPosition() const;
	Vector2 RandomCenterPosition() const;
	void OnDraw(sf::RenderWindow& window);
	

protected:
	int			m_id;
	
	float		m_top;
	float		m_left;
	float		m_bottom;
	float		m_right;

	float		m_width;
	float		m_height;

	Vector2		m_center;

};
